Skip to content

File dropzone - Add custom error messages for validation#1080

Open
prashanthr6383 wants to merge 2 commits into
mainfrom
1064-enable-error-message-for-file-dropzone
Open

File dropzone - Add custom error messages for validation#1080
prashanthr6383 wants to merge 2 commits into
mainfrom
1064-enable-error-message-for-file-dropzone

Conversation

@prashanthr6383
Copy link
Copy Markdown
Contributor

@prashanthr6383 prashanthr6383 commented May 7, 2026

📄 Summary of Changes

  • Added custom error message for

invalid type, invalid size. invalid name, invalid count

💭 Type of Change

  • Bug fix (fixes an issue)
  • New feature (adds functionality)
  • Configuration change (modifies scaling or properties of existing infrastructure & services)
  • Documentation change
  • Other

📋 Test Plan

✅ Self Code Review Checklist

PR authors and reviewers, please verify that all of these items have been completed.

  • My code is clean and readable
  • I followed standard conventions
  • Component code is WCAG 2.2 compliant (if applicable)
  • I have made theme files changes (if applicable)
  • I have made documentation changes (if applicable)
  • I have made Storybook changes including usage documentation (if applicable)
  • I have tested the component thoroughly in Storybook including RTL rendering (if applicable)

🔗 Work Item

Issue #1064

Copilot AI review requested due to automatic review settings May 7, 2026 07:37
@prashanthr6383 prashanthr6383 requested a review from a team as a code owner May 7, 2026 07:37
@prashanthr6383 prashanthr6383 linked an issue May 7, 2026 that may be closed by this pull request
2 tasks
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://trimble-oss.github.io/modus-wc-2.0/pr-preview/pr-1080/

Built to branch gh-pages at 2026-05-07 07:51 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for custom, per-validation error messaging in modus-wc-file-dropzone, allowing consumers to override default validation messages for invalid type, name, size, and count.

Changes:

  • Introduces a new errorMessages prop (typed as IFileDropzoneErrorMessages) and wires it into the internal getErrorMessage() fallback logic.
  • Updates Storybook examples to demonstrate setting errorMessages (including a docs snippet showing property assignment).
  • Adds Jest tests to verify custom message selection and fallback behavior (including legacy invalidFileTypeMessage fallback).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.tsx Adds IFileDropzoneErrorMessages + errorMessages prop and uses it in validation messaging fallbacks.
src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.stories.ts Documents and demonstrates errorMessages usage in Storybook (controls + example).
src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.spec.ts Adds tests covering custom error message selection and fallback behavior.
src/components/modus-wc-file-dropzone/readme.md Updates auto-generated docs to include the new errorMessages prop.
src/custom-elements.json Updates custom elements manifest to include error-messages.
src/components.d.ts Updates generated typings to export and surface IFileDropzoneErrorMessages on the component.

Comment thread src/components/modus-wc-file-dropzone/modus-wc-file-dropzone.tsx
@prashanthr6383 prashanthr6383 added the feature The PR raised is to add a feature label May 7, 2026
Copy link
Copy Markdown
Collaborator

@ElishaSamPeterPrabhu ElishaSamPeterPrabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation provides the ability to customize existing error state messages, but it does not support customizing the error state behavior itself.

Because of this limitation, it does not address the issue mentioned. They are trying to display an error state when uploads across multiple instances collectively exceed the maximum allowed count. However, with the current implementation, the count resets on each upload action, so this error state is not triggered.

@Sunder005 is this the expectation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature The PR raised is to add a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Error Message for File Dropzone

3 participants